/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.appspot.trick.it.admin.bind;

import com.appspot.trick.it.admin.task.ArticleGetByKeyTask;
import com.appspot.trick.it.admin.task.ArticleUpdateTask;
import com.appspot.trick.it.admin.task.ImagesUpdateTask;
import com.appspot.trick.it.admin.task.LogoImagesUpdateTask;
import javafx.beans.binding.BooleanBinding;

/**
 *
 * @author imamura
 */
public class EditProgressVisibleBinding extends BooleanBinding {
    
    private final ArticleGetByKeyTask articleGetByKeyTask;
    private final ArticleUpdateTask articleUpdateTask;
    private final ImagesUpdateTask imagesUpdateTask;
    private final LogoImagesUpdateTask logoImagesUpdateTask;
    

    /**
     * コンストラクタ
     * @param articleGetByKeyTask
     * @param articleUpdateTask
     * @param imagesUpdateTask
     * @param logoImagesUpdateTask
     */
    public EditProgressVisibleBinding(
            ArticleGetByKeyTask articleGetByKeyTask,
            ArticleUpdateTask articleUpdateTask,
            ImagesUpdateTask imagesUpdateTask,
            LogoImagesUpdateTask logoImagesUpdateTask
            ) {
        this.articleGetByKeyTask = articleGetByKeyTask;
        this.articleUpdateTask = articleUpdateTask;
        this.imagesUpdateTask = imagesUpdateTask;
        this.logoImagesUpdateTask = logoImagesUpdateTask;

        super.bind(articleGetByKeyTask.runningProperty());
        super.bind(articleUpdateTask.runningProperty());
        super.bind(imagesUpdateTask.runningProperty());
        super.bind(logoImagesUpdateTask.runningProperty());
    }

    @Override
    protected boolean computeValue() {

        if(articleGetByKeyTask.runningProperty().getValue()) return true;
        if(articleUpdateTask.runningProperty().getValue()) return true;
        if(imagesUpdateTask.runningProperty().getValue()) return true;
        if(logoImagesUpdateTask.runningProperty().getValue()) return true;
        
        return false;
    }
}
